package com.frxuexi.mdm2204

import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import com.frxuexi.apps.view.AppsPage
import com.frxuexi.document.DocPage
import com.frxuexi.document.LocalDocPage
import com.frxuexi.lib_base.RouterPath
import com.frxuexi.mdm2204.view.HomePage
import com.frxuexi.mdm2204.view.MessagePage
import com.frxuexi.user.view.MinePage
import com.frxuexi.report.view.CommitReportPage
import com.frxuexi.report.view.ReportPage
import com.frxuexi.sign.view.SignCommitPage
import com.frxuexi.sign.view.SignPage
import com.frxuexi.user.view.ApproveListPage
import com.frxuexi.user.view.ApprovePage
import com.frxuexi.user.view.AskForPage
import com.frxuexi.user.view.AskListPage
import com.frxuexi.user.view.LoginPage
import com.frxuexi.user.view.RegisterPage
import com.frxuexi.user.view.UserAskDetailPage

@Composable
fun MyNavHost(it:PaddingValues,navController: NavHostController) {
    NavHost(
        modifier = androidx.compose.ui.Modifier.padding(it),
        navController = navController,
        startDestination = RouterPath.MESSAGE_PAGE,
        builder = {
            composable(RouterPath.MESSAGE_PAGE) { MessagePage(navHostController = navController) }
            composable(RouterPath.HOME_PAGE) { HomePage(navController) }
            composable(RouterPath.MINE_PAGE) { MinePage(navController) }
            composable(RouterPath.APPS_PAGE) { AppsPage(navController) }
//            composable("news") { NewsPage() }
            composable(RouterPath.DOC_PAGE) { DocPage(navController) }
            composable(RouterPath.LOCALDOC_PAGE) { LocalDocPage(navController) }
            composable(RouterPath.REPORT_PAGE) { ReportPage(navController) }
            composable(RouterPath.COMMITREPORT_PAGE+"/{report}") {
                val json = it.arguments?.getString("report", "")
                CommitReportPage(navController,json!!) }
            composable(RouterPath.SIGN_PAGE) { SignPage(navController) }
            composable(RouterPath.SIGNCOMMIT_PAGE) { SignCommitPage(navController) }
            composable(RouterPath.REGISTER_PAGE) { RegisterPage(navController) }
            composable(RouterPath.LOGIN_PAGE) { LoginPage(navController) }
            composable(RouterPath.ASKFOR_PAGE) { AskForPage(navController) }
            composable(RouterPath.ASKLIST_PAGE) { AskListPage(navController) }
            composable(RouterPath.USERASKDETAIL_PAGE+"/{ask}") {
                val json = it.arguments?.getString("ask", "")
                UserAskDetailPage(navController,json!!) }
            composable(RouterPath.APPROVELIST_PAGE) { ApproveListPage(navController) }
            composable(RouterPath.APPROVE_PAGE+"/{ask}") {
                val json = it.arguments?.getString("ask", "")
                ApprovePage(navController,json!!) }
        })
}